<?php
/**
 * RedCross Application
 *
 * @copyright Copyright (c) 2010, Kristian Stokke Tryggestad, Rune Vikestad, Andreas Flaten Wist, Simen Nicolai Echholt, Ole Henrik Jahren
 */


class Admin_Form_Course_Basic extends RedCross_Form
{

    public function init()
    {
    $this->addElement('text', 'name', array(
      'filters'     => array('StringTrim'),
      'validators'  => array(
                array('Alnum', true, true),
        array('StringLength', true, array(3, 32)),
            ),
      'required'  => true,
      'label'    => 'Navn',
    ));

    $this->addElement('text', 'months_valid', array(
      'filters'     => array('StringTrim'),
            'validators'  => array(
                array('Digits', true),
        array('StringLength', true, array(1, 2)),
            ),
      'required'  => false,
      'label'    => 'Gyldighetstid (mnd)'
    ));

    // TODO: Get options from the Course gateway (via doctrine)
    // TODO: Validate that the selected option is valid per the gateway definition
    $this->addElement('select', 'type', array(
        'required' => true,
        'label' => "Type",
        'multiOptions' => array(
            'course' => 'Kurs',
            'competence' => 'Kompetanse'
        ),
        'value' => 'course'
    ));

    $this->addElement('submit', 'submit', array(
            'required' => true,
            'ignore'   => true,
            'label'    => 'Lagre',
        ));
    }
}
